package controller;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import service.BigDaddy;
import service.BigMamaThread;
import service.URLGettorManager;

public class MyServletContext implements ServletContextListener {

	public static URLGettorManager urlManager = null;
	public static boolean gettingUrl = false;
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		System.out.println("Stop");
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		if(!BigDaddy.started){			
			BigDaddy.initAll();
			BigDaddy.bigMum = new BigMamaThread();
			BigDaddy.bigMum.start();
			BigDaddy.started = true;
		}		
		if(urlManager==null){
			urlManager =  new URLGettorManager();			
		}			
		urlManager.start();
		gettingUrl = true;
	}

	public static void main(String[] args) {

	}

}